<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />    
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/api.js"></script></head>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
</head>
<body>

    <header class="header header-f" style="padding-top:2rem; height:4rem;">
        <div class="commission-header-l aui-pull-left" onclick="closeWin()">
            <i class="fa fa-angle-left"></i>
        </div>
        <div class="header-title">
            宣传推广佣金
        </div>
        <div class="commission-header-r aui-pull-right" tapmode onclick="withdraw()">
            <span>提现明细</span>
        </div>
    </header>
    <div style="height:4rem;"></div>
    <div id="list">
        <div class="commission-t">
            1242.00
            <p>累计佣金(元)</p>
        </div>

        <div class="aui-content aui-margin-b-15">
            <ul class="aui-list aui-list-in">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-money"></i>
                            可提现佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-clock-o"></i>
                            已申请佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-coffee"></i>
                            待打款佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-question-circle-o"></i>
                            失效佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-sign-in"></i>
                            成功提现佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-refresh"></i>
                            待收货佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            <i class="fa fa-lock"></i>
                            未结算佣金
                        </div>
                        <div class="aui-list-item-right">
                            0.00元
                        </div>
                    </div>
                </li>
            </ul>
        </div>

        <div class="aui-content">
            <ul class="aui-list aui-list-in">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">
                            用户须知
                        </div>
                    </div>
                </li>
                <div class="commission-d">
                    买家确认收货后，立即获得宣传推广佣金<br>注意：可用佣金满<span class="c-red">1元</span> 后才能申请提现
                </div>
            </ul>
        </div>

        <div style="height: 3rem;"></div>
    </div>
    <div class="commission-btn no">我要提现</div>

</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/template" id="template">
    <div class="commission-t">
        {{=it.saleMoneyTotal}}
        <p>累计佣金(元)</p>
    </div>

    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-money"></i>
                        可提现佣金
                    </div>
                    <div class="aui-list-item-right">
                        0.00元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-clock-o"></i>
                        已申请佣金
                    </div>
                    <div class="aui-list-item-right">
                        0.00元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-coffee"></i>
                        待结算佣金
                    </div>
                    <div class="aui-list-item-right">
                        {{=it.saleMoney_1}}元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-question-circle-o"></i>
                        失效佣金
                    </div>
                    <div class="aui-list-item-right">
                        {{=it.saleMoney_0}}元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-sign-in"></i>
                        已结算佣金
                    </div>
                    <div class="aui-list-item-right">
                        {{=it.saleMoney_2}}元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-refresh"></i>
                        待收货佣金
                    </div>
                    <div class="aui-list-item-right">
                        0.00元
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        <i class="fa fa-lock"></i>
                        未结算佣金
                    </div>
                    <div class="aui-list-item-right">
                        0.00元
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <div class="aui-content">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        用户须知
                    </div>
                </div>
            </li>
            <div class="commission-d">
                买家确认收货后，立即获得宣传推广佣金<br>注意：可用佣金满<span class="c-red">1元</span> 后才能申请提现
            </div>
        </ul>
    </div>

    <div style="height: 3rem;"></div>

</script>
<script type="text/javascript">
    apiready = function(){
        loadData();
    }
    
    function loadData(type){
        var userid = $api.getStorage('userid');
        var authtoken = $api.getStorage('authtoken');
        api.ajax({
            url: webAddress + '/a/sale/info/money',
            method: 'post',
            data: {
                values: {
                },
            },
            headers: {
                TOKEN: token,
                authuid: userid,
                authtoken: authtoken,
                'Content-Type': 'application/x-www-form-urlencoded',
            },
        },function(ret, err){
            if (ret) {
                alert( JSON.stringify( ret ) );

                // 时间戳转换为时间
             //    var data = ret.result.data;
             //    for (var i = 0; i < data.length; i++) {
             //     data[i].create_time = toDate(data[i].create_time);   
             // }

             templateFun(ret.result.data);
         } else {

                // alert( JSON.stringify( err ) );
                // if (err.body.message) {
                //     api.toast({
                //         msg: err.body.message,
                //         duration: 2000,
                //         location: 'bottom'
                //     });
                // }
                return false;
            }
        });
    }

    // 模板赋值函数
    function templateFun(data){
        if (data) {
          var template = $api.byId('template');
          var dotFn = doT.template(template.innerHTML);
          var html = dotFn(data);
          var list = $api.byId('list');
          $api.html(list, html);
      }else{

          var list = $api.byId('list');
          var html = '<h2 style="padding:1rem; text-align:center; color:#999; font-size:1rem;">暂无内容</h2>';
          list.innerHTML = html;
      }
  }

  function withdraw(){
    var delay = 0;
    if(api.systemType != 'ios'){
        delay = 300;
    }
    api.openWin({
        name: 'withdraw',
        url: './distribution_withdraw.html',
        bounces:false,
        delay: delay,
        slidBackEnabled:true,
        vScrollBarEnabled:false,
        progress:{
            type:"page"
        }
    });
}
function closeWin(){
    api.closeWin({
    });
}
</script>
</html>